from ultralytics import YOLO

model = YOLO('models/yolov8n-oiv7.pt')

model.info()

results = model.predict(
    source='images/Snipaste_2023-11-11_00-32-21.png',
    stream=False,
    device='0',
    save=False,
    save_txt=False,
)
print('results:', len(results))

for i, result in enumerate(results):
    print('speed', result.speed)

    # 目标检测
    boxes = result.boxes

    print('result', i)
    print(boxes)

    # 分割
    # masks = result.masks
    # 姿态
    # keypoints = result.keypoints
    # 分类
    # probs = result.probs

print('end')
